import request from "@/utils/request";
import { AxiosPromise } from "axios";

/**
 * 平台主子单号配置数据
 *
 * @param queryParams
 */
export function getSysMainSubNoConfigPage(queryParams): AxiosPromise<PageResult<[]>> {
	return request({
		url: '/api/v1/mainSubNoConfig/page',
		method: 'get',
		params: queryParams
	});
}


/**
 * 获取平台主子单号配置表单数据
 *
 * @param preformKey 平台
 */
export function getSysMainSubNoConfigForm(preformKey) {
	return request({
		url: '/api/v1/mainSubNoConfig/' + preformKey + '/form',
		method: 'get'
	});
}

/**
 * 保存平台主子单号配置
 *
 * @param data
 */
export function saveSysMainSubNoConfig(data) {
	return request({
		url: "/api/v1/mainSubNoConfig",
		method: "post",
		data: data,
	});
}

/**
 * 删除平台主子单号配置
 *
 * @param ids
 */
export function deleteSysMainSubNoConfig(ids: string) {
	return request({
		url: '/api/v1/mainSubNoConfig/' + ids,
		method: 'delete'
	});
}

/**
 * 导入平台主子单号配置
 *
 * @param file
 */
export function importSysMainSubNoConfig(file: any) {
	const formData = new FormData();
	formData.append('file', file);
	return request({
		url: '/api/v1/mainSubNoConfig/sysMainSubNoConfigImport',
		method: 'post',
		data: formData,
		headers: {
			'Content-Type': 'multipart/form-data'
		}
	});
}

/**
 * 导出平台主子单号配置
 *
 * @param ids
 * @returns
 */
export function exportSysMainSubNoConfig(ids: any) {
	return request({
		url: '/api/v1/mainSubNoConfig/_export?ids='+ids,
		method: 'get',
		responseType: 'arraybuffer'
	});
}
